﻿#region  文件信息
// ---------------------------------------------------------------------------------------
// <copyright file="AliWapNotifymodel.cs" company="">
// 作者：李帅伦
// </copyright>
// <summary>
// 类型简介：
// 类型详细：AliWapNotifymodel.cs
// 创建时间：2015-01-14 17:07
// 修改时间：2015-01-14 17:07
// </summary>
// ---------------------------------------------------------------------------------------
#endregion
namespace Payment.Albaba.WapCode
{
    using System.Xml;

    /// <summary>
    /// 通知模型
    /// </summary>
    public class AliWapNotifyModel
    {
        public AliWapNotifyModel()
        {
            this.xmlDoc = new XmlDocument(); 
        }

        /// <summary>
        /// 解析XMML
        /// </summary>
        /// <returns></returns>
        public void GetnonotifyDataXml()
        {
            this.xmlDoc.LoadXml(this.notify_data);
        }

        private XmlDocument xmlDoc;

        public string notify_data { get; set; }

        public string sign { get; set; }

        /// <summary>
        /// 商户订单ID
        /// </summary>
        public string OrderId
        {
            get
            {
                var selectSingleNode = this.xmlDoc.SelectSingleNode("/notify/out_trade_no");
                if (selectSingleNode != null)
                {
                    return selectSingleNode.InnerText;
                }
                else
                {
                    return "null";
                }
            }
        }

        /// <summary>
        /// 支付宝交易号
        /// </summary>
        public string TradeNo
        {
            get
            {
                var selectSingleNode = this.xmlDoc.SelectSingleNode("/notify/trade_no");
                if (selectSingleNode != null)
                {
                    return selectSingleNode.InnerText;
                }
                else
                {
                    return "null";
                }
            }
        }

        /// <summary>
        /// 交易状态
        /// </summary>
        public string TradeStatus
        {
            get
            {
                var selectSingleNode = this.xmlDoc.SelectSingleNode("/notify/trade_status");
                if (selectSingleNode != null)
                {
                    return selectSingleNode.InnerText;
                }
                else
                {
                    return "null";
                }
            }
        }

    }
}